<?php
/**
 * 
 * @authors Liujinbi (857053791@QQ.com)
 * @date    2017-08-11 16:53:27
 * @version $Id$
 */
namespace app\agent\controller;

use think\Db;
use think\Controller;
use Godok\Org\Auth;
use think\Config;

class Shop extends Base
{
    /**
     * 商户列表
     */
    public function index()
    {
        $uid = $this->uid;
         // 商户列表
        $keywords = Request()->get('keywords');
        $query = Db::table('sdzx_shop')->alias('s')
        ->join('sdzx_employee e','s.agent_id=e.id','left')
        ->join('sdzx_user u','s.user_id=u.id')
        ->order('s.create_time asc')
        ->where("e.id=$uid");
        if ($keywords) {
            $query->where("u.username like '%{$keywords}%' or s.shop_name like '%{$keywords}%' or s.shop_owner like '%{$keywords}%' or e.name like '%{$keywords}%'");
        }
        $list = $query->paginate();
        $data['list'] = $list;
        return $this->fetch('index',$data);

       
    }
}
